Netshell.factory("Api", ["$resource", function($resource){
	var apiUrl = function(route){ return "/api/" + route + (apiAp(route) ? "/:id" : ''); }
	var apiAp = function(route){ return route.indexOf(':') < 0; }
	var laraRes = function(route, df){
		var par = (apiAp(route) ? { id: '@id' } : df);
		return $resource(apiUrl(route), par, {
			"index": { method: "GET", isArray: true },
			"store": { method: "POST" },
			"show": { method: "GET" },
			"update": { method: "PUT" },
			"destroy": { method: "DELETE" },
			"forceDelete": { method: "GET", url: apiUrl(route+"/delete/:id"), params: par },
			"restore": { method: "GET", url: apiUrl(route+"/restore/:id"), params: par }
		});
	};
	return {
		Project: function(){ return laraRes("project"); }
	};
}]);